function model=update_sigma_2(model,n, MaxFun)


x0 = (model.sigma_2(n,:)').^2;
A  = -eye(size(x0,1));
B  = zeros(size(x0,1),1);

%options   = optimset('Algorithm','interior-point', 'MaxFunEvals', MaxFun, 'Display', 'off');

options = optimset('Algorithm','interior-point','GradObj','on', 'MaxFunEvals', MaxFun, 'Display', 'off');


temp      = sqrt([fmincon(@L_sigma_2, x0, A, B, [], [], [], [], [], options, model, n)]');
ind       = find(temp<model.sigmamin);
temp(ind) = model.sigmamin;
model.sigma_2(n,:) = temp; 


end
